﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;
namespace GalaxyDefenderChaos
{
    public class My2DButton : VisibleGameEntity
    {
        Texture2D _Texture;
        Vector2 _Size;
        private Vector2 _Position;

        public Vector2 Position
        {
            get { return _Position; }
            set { _Position = value; }
        }

        public Vector2 Size
        {
            get { return _Size; }
            set { _Size = value; }
        }

        public My2DButton(ContentManager content, string strTexture, Vector2 position, Vector2 size)
        {
            _Texture = content.Load<Texture2D>(strTexture);
            _Size = size;
            _Position = position;
        }

        public override void Draw(GraphicsDevice graphicsDevice, Camera camera, GameTime gameTime)
        {
            SpriteBatch spriteBatch = new SpriteBatch(graphicsDevice);
            spriteBatch.Begin();
            spriteBatch.Draw(_Texture, new Rectangle((int)_Position.X, (int)_Position.Y, (int)_Size.X, (int)_Size.Y), Color.White);
            spriteBatch.End();
        }

        public void Draw(GraphicsDevice graphicsDevice, Camera camera, GameTime gameTime, Color color)
        {
            SpriteBatch spriteBatch = new SpriteBatch(graphicsDevice);
            spriteBatch.Begin();
            spriteBatch.Draw(_Texture, new Rectangle((int)_Position.X, (int)_Position.Y, (int)_Size.X, (int)_Size.Y), color);
            spriteBatch.End();
        }

        public bool CheckInside(Vector2 point)
        {
            if (point.X >= _Position.X && point.X <= _Position.X + _Size.X
                && point.Y >= _Position.Y && point.Y <= _Position.Y + _Size.Y)
                return true;
            return false;
        }
    }
}
